Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

203
Views
TypeError: option.getMember("target) is not a function

So I made this kick command and I finished coding it. Now I am getting this error and have literally no idea how to fix it. I searched through the internet for an hour now and have still no idea where the issue is.

Here is the error:

TypeError: options.getMember is not a function
    at Object.execute (/Users/Aplex/Documents/Aplel/Commands/Moderation/kick.js:32:32)
    at Object.execute (/Users/Aplex/Documents/Aplel/Events/Interaction/interactionCreate.js:21:21)
    at Client.<anonymous> (/Users/Aplex/Documents/Aplel/Structures/Handlers/Events.js:18:54)
    at Client.emit (node:events:538:35)
    at InteractionCreateAction.handle (/Users/Aplex/Documents/Aplel/node_modules/discord.js/src/client/actions/InteractionCreate.js:74:12)
    at Object.module.exports [as INTERACTION_CREATE] (/Users/Aplex/Documents/Aplel/node_modules/discord.js/src/client/websocket/handlers/INTERACTION_CREATE.js:4:36)
    at WebSocketManager.handlePacket (/Users/Aplex/Documents/Aplel/node_modules/discord.js/src/client/websocket/WebSocketManager.js:351:31)
    at WebSocketShard.onPacket (/Users/Aplex/Documents/Aplel/node_modules/discord.js/src/client/websocket/WebSocketShard.js:444:22)
    at WebSocketShard.onMessage (/Users/Aplex/Documents/Aplel/node_modules/discord.js/src/client/websocket/WebSocketShard.js:301:10)
    at WebSocket.onMessage (/Users/Aplex/Documents/Aplel/node_modules/ws/lib/event-target.js:199:18)

And here is my code:

const { Client, CommandInteraction } = require("discord.js");

module.exports = {
    name: "kick",
    description: "Kick a member",
    userPermission: ["KICK_MEMBERS"],
    options: [
        {
            name: "target",
            description: "target to kick",
            type: "USER",
            required: true
        },
        {
            name: "reason",
            description: "reason for this kick",
            type: "STRING",
            required: false,
        }
    ],
    /**
     * 
     * @param {Client} client 
     * @param {CommandInteraction} interaction 
     * @param {String} args 
     */
    execute: async(client, interaction, args) => {
        const { options, member } = interaction;

        const target = options.getMember("target");
        const reason = options.getString("reason") || "No reason provided";

        if(!target.roles.highest.position >= member.roles.highest.position) return interaction.followUp({content: "You can't take action on this user as their role is higher than yours!",
    });

    await target.send(`You have been kicked from ${interaction.guild.name}, reason ${reason}`);

    target.kick(reason);

    interaction.followUp({content: `Kicked ${target.user.tag} successfully! reason: ${reason}`});
    },
};

Anyone know where the issue is here? It would be really appreciated if someone helped!

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

can I assume you are following lyxcode tutorials?

If so, in the line

execute(client, interaction, args)

change it to

execute(interaction, client, args)

this should then match your interactionCreate file.

also, change followUp to reply

hopefully this fixes it for you!

about 4 years ago · Juan Pablo Isaza Report

0

If you are trying to get the member's account cache, maybe you should try something like this: client.members.cache.get('User ID');

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!